<template>
  <div>
    <video :src="message.videoUrl" :poster="message.snapshotUrl" controls style="width:300px"  :style="{height:height + 'px'}"></video>
  </div>
</template>

<script>
import { Progress } from "element-ui";
import { mapGetters } from "vuex";
export default {
  name: "ImageElemnt",
  data() {
    return {
      message: {},
      height: 0,
    };
  },
  props: {
    payload: {
      type: Object,
      required: true,
    },
  },
  components: {
    ElProgress: Progress,
  },
  watch: {
    payload: {
      handler: function (newVal) {
        this.message = newVal;
        let scale = newVal.snapshotWidth / newVal.snapshotHeight;
        this.height = 300 / scale - 10;
      },
      immediate: true,
      deep: true,
    },
  },
  computed: {},
  methods: {},
};
</script>

<style scoped>
</style>
